#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
typedef struct Point{
	int x;
	int y;
}Point;  
double ComputeDis(Point a, Point b)
{
	return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));
}
int main()
{
	int num;
	cin >> num;
	for (int k = 0; k < num; k++)
	{
		int n;
		cin >> n;
		Point points[n+1];
		for (int i = 0; i < n; i++)
		{
			cin >> points[i].x >> points[i].y;
		}
		double min = 500000;
		double dis = 0;
		for (int i = 0; i < n; i++)
		{
			for (int j = i+1; j < n; j++)
			{
				dis = ComputeDis(points[i], points[j]); 
				if (min > dis)
				{
					min = dis;
				}
			}
		}
		printf("%.4f\n", min);
	}
	
} 
